package com.jr.controller;

import com.github.pagehelper.PageInfo;
import com.jr.service.PaymentsVehiclesParkingRecordsService;
import com.jr.vo.PaymentsVehiclesParkingRecordsVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 支付记录、车辆和停车记录关联查询控制器
 */
@RestController
@RequestMapping("/api/payments-vehicles-parking-records")
public class PaymentsVehiclesParkingRecordsController {

    @Resource
    private PaymentsVehiclesParkingRecordsService paymentsVehiclesParkingRecordsService;

    /**
     * 分页模糊查询支付记录、车辆和停车记录信息
     * @param pageNum 当前页码，默认为1
     * @param pageSize 每页条数，默认为8
     * @param plateNumber 车牌号（模糊查询）
     * @param status 支付状态（模糊查询）
     * @param entryTime 入场时间（模糊查询）
     * @param exitTime 出场时间（模糊查询）
     * @return 分页查询结果
     */
    @GetMapping("/page")
    public PageInfo<PaymentsVehiclesParkingRecordsVo> findPaymentsByPage(
            @RequestParam(defaultValue = "1") Integer pageNum,
            @RequestParam(defaultValue = "8") Integer pageSize,
            @RequestParam(required = false) String plateNumber,
            @RequestParam(required = false) Integer status,
            @RequestParam(required = false) String entryTime,
            @RequestParam(required = false) String exitTime) {

        // 调用Service层方法
        return paymentsVehiclesParkingRecordsService.findPaymentsByPage(
                pageNum,
                pageSize,
                plateNumber,
                status,
                entryTime,
                exitTime
        );
    }
}